<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="format-detection" content="telephone=no">
    <link rel='stylesheet' href='../CSS/splitting.css'>
    <link rel="stylesheet" href="../CSS/style.css">
    <script src='../JS/splitting.js' defer="defer"></script>
    <script src="../JS/script.js" defer="defer"></script>
    <title>添加新闻</title>
    <link href="../CSS/AddNews.css" rel="stylesheet">
</head>
<body>
<div class="Add">
    <form action="#">
    <div class="clock_te">
        <div class="clock">

            <span class="cog hours tens" data-splitting>0123456789</span>
            <span class="cog hours" data-splitting>0123456789</span>
            <span class="colon">:</span>
            <span class="cog minutes tens" data-splitting>0123456789</span>
            <span class="cog minutes" data-splitting>0123456789</span>
            <span class="colon">:</span>
            <span class="cog seconds tens" data-splitting>0123456789</span>
            <span class="cog seconds" data-splitting>0123456789</span>

        </div>
    </div>
    <span>标题</span><br><input name="title" class="title" placeholder="输入标题..."><br><br>
    <span>作者</span><br><input name="author" class="author" placeholder="输入作者..."><br><br>
    <span>类型</span><br>
    <button class="Tbut" type="button" id="but1" onclick="Typebut(this)">政治新闻</button>
    <button class="Tbut" type="button" id="but2" onclick="Typebut(this)">社会新闻</button>
    <button class="Tbut" type="button" id="but3" onclick="Typebut(this)">体育新闻</button>
    <button class="Tbut" type="button" id="but4" onclick="Typebut(this)">文教新闻</button>
    <button class="Tbut" type="button" id="but5" onclick="Typebut(this)">科技新闻</button>
    <button class="Tbut" type="button" id="but6" onclick="Typebut(this)">军事新闻</button>
    <button class="Tbut" type="button" id="but7" onclick="Typebut(this)">法律新闻</button><br><br>
    <span>内容</span><br><textarea name="Text1" cols="40" rows="5" class="content" id="content1"></textarea>
        <input style="display: none" id="type" name="type">
        <input style="display: none" id="content" name="content">
    <input style="margin-bottom: -50px" class="sub" type="submit" disabled value="添加">
    </form>
</div>
<script type="text/javascript">
    function Typebut(but){
        for (var i =0;i<7;i++) {
            document.getElementsByClassName("Tbut")[i].style.backgroundColor = "rgba(200,200,200,0.25)";
            if(document.getElementByClassNames('Tbut')[i]==but){
            	console.log(i);
            	document.getElemntById('type').value=i;
            }
        }
        but.style.backgroundColor="lightblue";
        document.getElementById("type").value=but.innerHTML;
        // console.log(document.getElementById("type").value);
    }
</script>
</body>
</html>